package edu.hawaii.senin.iclouds.basics;

/**
 * Represents Long accumulator.
 * 
 * @author Pavel Senin.
 * 
 */
public class LongAccumulator implements Accumulator<Long> {

  private String name;

  private Long value;

  /**
   * Instantiates the LongAccumulator with the value provided.
   * 
   * @param longValue the value to set.
   */
  public LongAccumulator(long longValue) {
    this.name = null;
    this.value = longValue;
  }

  /**
   * Instantiates the LongAccumulator with the name provided. The accumulator value will be set to
   * 0.
   * 
   * @param strValue the value to set.
   */
  public LongAccumulator(String strValue) {
    this.name = strValue;
    this.value = 0L;
  }

  /**
   * Instantiates the LongAccumulator with the name and value provided.
   * 
   * @param strValue the name to set.
   * @param longValue the value to set.
   */
  public LongAccumulator(String strValue, Long longValue) {
    this.name = strValue;
    this.value = longValue;
  }

  /** {@inheritDoc} */
  public String getName() {
    return this.name;
  }

  /** {@inheritDoc} */
  public Long getValue() {
    return this.value;
  }

  /** {@inheritDoc} */
  public void increment(Long incValue) {
    this.value += incValue;
  }

  /** {@inheritDoc} */
  public void setName(String name) {
    this.name = name;
  }

  /** {@inheritDoc} */
  public void setValue(Long value) {
    this.value = value;
  }

  /**
   * Incremets accumulator value by 1.
   * 
   */
  public void increment() {
    this.value += 1;
  }

}
